/*  ------------------------------------------------------------------------  */
/*  Paper        : Does Stakeholder Outrage Determine Executive Pay?          */
/*  Program      : a02-02-sample_summary.do                                   */
/*  Description  : Sample summary and distributions                           */
/*  ------------------------------------------------------------------------  */

/*  ------------------------------------  */
//  Annual sample breakdown 

use "$temp112/outragePanel.dta", clear

foreach year of numlist 2014/2021 {
	gen yr_`year' = 1 if fyear == `year'
		la var yr_`year' "`year'"
}

/*  ------------------------------------------------------------------------  */
// Summarize dummies

local sumvars yr_????
eststo tr_1: quietly estpost summarize `sumvars' if ret_cnt==12 & !missing(boardid)
eststo tr_2: quietly estpost summarize `sumvars' if execucomp_d==3 & ret_cnt==12 & !missing(boardid) & year(begdat)<2019
eststo tr_3: quietly estpost summarize `sumvars' if mainsample==1
eststo tr_4: quietly estpost summarize `sumvars' if mainsample==1 & dcut_all==1

esttab tr_?, noobs cells("sum_w(pattern(1 1 1 1 1) )")

/*  ------------------------------------------------------------------------  */

use "$temp112/outragePanel.dta", clear
gen _dcut = (dcut_all*-1)

/*  ------------------------------------------------------------------------  */
//  Sample breakdown - annual 

foreach var of varlist tdc1 salary varcomp bonus stock_awards_fv option_awards_fv noneq_incent othcomp defer_rpt_as_comp_tot mcap oancf ivncf fincf xint ch che ivst {
replace `var' = `var' / 1000
}

foreach var of varlist xint {
	replace `var' = 0 if missing(`var')
}

#delimit ;
local ch2020
tdc1 salary dcutAmount varcomp bonus stock_awards_fv option_awards_fv
noneq_incent defer_rpt_as_comp_tot othcomp tdc1_chg salary_chg varcomp_chg
bonus_chg stock_awards_fv_chg option_awards_fv_chg noneq_incent_chg
defer_rpt_as_comp_tot_chg othcomp_chg mcap emp btm leverage_mkt tangibility
roa_std chAt xrd_at payout_d boardSize nedTenure ceo_tenure exret_12m ret_std
prc_delta exret_202012 instoHhi
; #delimit cr

local iff fyear==2020 & mainsample==1

eststo ch2020_1: quietly estpost summarize `ch2020' if `iff', detail
eststo ch2020_2: quietly estpost summarize `ch2020' if dcut_all==0 & `iff', detail
eststo ch2020_3: quietly estpost summarize `ch2020' if dcut_all==1 & `iff', detail
eststo ch2020_4: quietly estpost ttest `ch2020' if `iff', by(_dcut) unequal

foreach var of varlist _all {
	label var `var' ""
}

#delimit ;
esttab ch2020_1 ch2020_2 ch2020_3 ch2020_4,
	nonumbers nodepvars star(* 0.10 ** 0.05 *** 0.01)
	stats(N, fmt(%9.0fc) labels("Firms"))
	cells("mean(pattern(1 1 1 0) label(Mean) fmt(%9.3fc))
			b(star pattern(0 0 0 1) label(Diff) fmt(%9.3fc))
			t(pattern(0 0 0 1) label(t-stat) par fmt(3))") label notes
; #delimit cr

/*  -|----------------------------------------------------------------------  */
/*  ||  ---    Program end: a02-02-sample_summary.do                          */
/*  -|  ---    Attila Balogh    --------------------------------------------  */